package com.alongstudio.account.dao.impl;

import java.util.ArrayList;
import java.util.List;

import org.springframework.stereotype.Repository;

import com.alongstudio.account.commons.exception.BusinessException;
import com.alongstudio.account.dao.IClientUserDao;
import com.alongstudio.account.dao.base.impl.BaseDao;
import com.alongstudio.account.entity.ClientUser;

@Repository(value="ClientUserDao")
public class ClientUserDao extends BaseDao<ClientUser> implements IClientUserDao{

	@Override
	public ClientUser checkUserLogin(String userName, String password) throws BusinessException {
		String hql = "from ClientUser u where u.userName=? and u.password=? ";
		List param = new ArrayList();
		param.add(userName);
		param.add(password);
		List<ClientUser> users = this.queryByHql(hql, param);
		if (users != null && !users.isEmpty()) {
			ClientUser user = users.get(0);
			return user;
		}
		return null;
	}

	
}

